Option Explicit

'################################################################
' 常量
'################################################################
' 切片中，设置空引用时，使用的槽位值
Public Const SERIES_SLICE_EMPTY_REF_SLOT_VAL As Long = -11

' Empty 输出到控制台时的内容
Public Const EMPTY_STR_IN_CONSOLE As String = "@@EMPTY@@"

'################################################################
' 类型、枚举定义
'################################################################
' ==========================================
' 列的类型
' ==========================================
' 列类型枚举
Public Enum DF_DataType
    ' 整型数字
    DF_INT = 1
    ' 长整型数字
    ' DF_LONG = 2
    ' 浮点型数据 Decimal + Single + Double
    DF_DECIMAL = 3
    ' 日期 ---> 保存形式 yyyyMMdd
    DF_DATE = 4
    ' 时间 ---> 保存形式 hhmmss
    DF_TIME = 5
    ' 时间戳 ---> 保存形式 yyyyMMdd hhmmss
    DF_TIMESTAMP = 6
    ' 字符串
    DF_STRING = 7
    ' 布尔型
    DF_BOOLEAN = 8
End Enum

' ==========================================
' DataFrame 内适用的比较运算符
' ==========================================
Public Enum DF_CompareOperator
    ' =
    ' 只需要 1 个比较数据
    DF_EQUAL = 1
    ' !=, <>
    ' 只需要 1 个比较数据
    DF_NO_EQUAL = 2
    ' <, &lt;
    ' 只需要 1 个比较数据
    DF_LESS  = 3
    ' >, &gt;
    ' 只需要 1 个比较数据
    DF_GREATER = 4
    ' <=, &lt;=
    ' 只需要 1 个比较数据
    DF_LESS_EQUAL = 5
    ' >=, &gt;=
    ' 只需要 1 个比较数据
    DF_GREATER_EQUAL = 6
    ' in
    ' 至少需要 1 个比较数据
    DF_IN  = 7
    ' IS
    ' 只需要 1 个比较数据
    DF_IS = 8
    ' between and
    ' 需要 2 个比较数据
    DF_BETWEEN_AND = 9
End Enum

'################################################################
' 创建各列类型的处理器
'################################################################
' DF_DataType 处理器缓存
Private dataTypeHandlerMap As Object
Public Function getDataTypeHandler(ByRef dType As DF_DataType) As IDFDataTypeHandler
    If dataTypeHandlerMap Is Nothing Then
        Set dataTypeHandlerMap = UtilsCreateSysObj.createMap
    End If

    If dType = DF_DataType.DF_INT Then
        ' 整型数字
        If dataTypeHandlerMap.Exists(dType) Then
            Set getDataTypeHandler = dataTypeHandlerMap.Item(dType)
        Else
            Dim r1 As DFDataTypeIntHandler
            Set r1 = New DFDataTypeIntHandler
            Set getDataTypeHandler = r1

            dataTypeHandlerMap.Add dType, r1
        End If
    ElseIf dType = DF_DataType.DF_DECIMAL Then
        ' 浮点型数据 Decimal + Single + Double
        If dataTypeHandlerMap.Exists(dType) Then
            Set getDataTypeHandler = dataTypeHandlerMap.Item(dType)
        Else
            Dim r2 As DFDataTypeDecimalHandler
            Set r2 = New DFDataTypeDecimalHandler
            Set getDataTypeHandler = r2

            dataTypeHandlerMap.Add dType, r2
        End If
    ElseIf dType = DF_DataType.DF_DATE Then
        ' 日期 ---> 保存形式 yyyyMMdd
        If dataTypeHandlerMap.Exists(dType) Then
            Set getDataTypeHandler = dataTypeHandlerMap.Item(dType)
        Else
            Dim r3 As DFDataTypeDateHandler
            Set r3 = New DFDataTypeDateHandler
            Set getDataTypeHandler = r3

            dataTypeHandlerMap.Add dType, r3
        End If
    ElseIf dType = DF_DataType.DF_TIME Then
        ' 时间 ---> 保存形式 hhmmss
        If dataTypeHandlerMap.Exists(dType) Then
            Set getDataTypeHandler = dataTypeHandlerMap.Item(dType)
        Else
            Dim r4 As DFDataTypeTimeHandler
            Set r4 = New DFDataTypeTimeHandler
            Set getDataTypeHandler = r4

            dataTypeHandlerMap.Add dType, r4
        End If
    ElseIf dType = DF_DataType.DF_TIMESTAMP Then
        ' 时间戳 ---> 保存形式 yyyyMMdd hhmmss
        If dataTypeHandlerMap.Exists(dType) Then
            Set getDataTypeHandler = dataTypeHandlerMap.Item(dType)
        Else
            Dim r5 As DFDataTypeTimestampHandler
            Set r5 = New DFDataTypeTimestampHandler
            Set getDataTypeHandler = r5

            dataTypeHandlerMap.Add dType, r5
        End If
    ElseIf dType = DF_DataType.DF_BOOLEAN Then
        ' 布尔型
        If dataTypeHandlerMap.Exists(dType) Then
            Set getDataTypeHandler = dataTypeHandlerMap.Item(dType)
        Else
            Dim r6 As DFDataTypeBooleanHandler
            Set r6 = New DFDataTypeBooleanHandler
            Set getDataTypeHandler = r6

            dataTypeHandlerMap.Add dType, r6
        End If
    Else
        ' 剩余类型全部使用字符串
        If dataTypeHandlerMap.Exists(dType) Then
            Set getDataTypeHandler = dataTypeHandlerMap.Item(dType)
        Else
            Dim r7 As DFDataTypeStringHandler
            Set r7 = New DFDataTypeStringHandler
            Set getDataTypeHandler = r7

            dataTypeHandlerMap.Add dType, r7
        End If
    End If
End Function

'################################################################
' 类型、枚举定义的辅助方法
'################################################################
' ==========================================
' 列的类型
' ==========================================
' 检查数据的类型是否匹配
' @param t 类型
' @param d 数据
' @return boolean
Public Function checkDataType(ByRef t As DF_DataType, ByRef data As Variant) As Boolean
    Dim dt As String
    dt = TypeName(data)

    If t = DF_INT Then
        ' 长整型数字
        checkDataType = dt = "Integer" Or dt = "Long"
    ElseIf t = DF_DECIMAL Then
        ' 浮点型数据
        checkDataType = dt = "Decimal" Or dt = "Single" Or dt = "Double"
    ElseIf t = DF_DATE Then
        ' 日期
        checkDataType = dt = "Date"
    ElseIf t = DF_TIME Then
        ' 时间
        checkDataType = dt = "Date"
    ElseIf t = DF_TIMESTAMP Then
        ' 时间戳
        checkDataType = dt = "Date"
    ElseIf t = DF_STRING Then
        checkDataType = dt = "String"
    ElseIf t = DF_BOOLEAN Then
        checkDataType = dt = "Boolean"
    Else
        checkDataType = False
    End If
End Function

' 检查数据是否是整型数据
' @param val 数据
' @return boolean
Public Function checkDataIsInt(ByRef val As Variant) As Boolean
    Dim dt As Variant
    dt = VarType(val)

    checkDataIsInt = (dt = vbInteger) Or (dt = vbLong)
End Function

' 检查数据是否是小数、浮点数数据
' @param val 数据
' @return boolean
Public Function checkDataIsDecimal(ByRef val As Variant) As Boolean
    Dim dt As Variant
    dt = VarType(val)

    checkDataIsDecimal = (dt = vbSingle) Or (dt = vbDouble) Or (dt = vbDecimal)
End Function

' 根据类型枚举项，获取枚举名称
' @param t 枚举项
' @return 枚举名称
Public Function getDataTypeName(ByRef t As DF_DataType) As String
    If t = DF_INT Then
        ' 长整型数字
        getDataTypeName = "DF_INT"
    ElseIf t = DF_DECIMAL Then
        ' 浮点型数据
        getDataTypeName = "DF_DECIMAL"
    ElseIf t = DF_DATE Then
        ' 日期
        getDataTypeName = "DF_DATE"
    ElseIf t = DF_TIME Then
        ' 时间
        getDataTypeName = "DF_TIME"
    ElseIf t = DF_TIMESTAMP Then
        ' 时间戳
        getDataTypeName = "DF_TIMESTAMP"
    ElseIf t = DF_STRING Then
        ' 字符串
        getDataTypeName = "DF_STRING"
    ElseIf t = DF_BOOLEAN Then
        ' 布尔
        getDataTypeName = "DF_BOOLEAN"
    Else
        getDataTypeName = ""
    End If
End Function

' 将根据基础数据的类型转换成 DF_DataType 的某个枚举项
'
' 对于: 日期字符串 DF_DATE, 时间字符串 DF_TIME, 时间戳字符串 DF_TIMESTAMP
'       当前方法无法区分，需要手动设置
'
' 如果出现了无法判断的情况，统一设置成字符串类型
'
' @param val 基础类型数据
Public Function getDataTypeForPrimitiveData(ByRef val As Variant) As DF_DataType
    Dim valTypeName As String
    valTypeName = TypeName(val)

    If valTypeName = "String" Then
        getDataTypeForPrimitiveData = DF_DataType.DF_STRING
    ElseIf valTypeName = "Integer" Then
        getDataTypeForPrimitiveData = DF_DataType.DF_INT
    ElseIf valTypeName = "Long" Then
        getDataTypeForPrimitiveData = DF_DataType.DF_INT
    ElseIf valTypeName = "Double" Then
        getDataTypeForPrimitiveData = DF_DataType.DF_DECIMAL
    ElseIf valTypeName = "Single" Then
        getDataTypeForPrimitiveData = DF_DataType.DF_DECIMAL
    ElseIf valTypeName = "Decimal" Then
        getDataTypeForPrimitiveData = DF_DataType.DF_DECIMAL
    ElseIf valTypeName = "Boolean" Then
        getDataTypeForPrimitiveData = DF_DataType.DF_BOOLEAN
    ElseIf valTypeName = "Date" Then
        ' 因为 DF_TIME, DF_TIME, DF_TIMESTAMP 都是 Date 类型的数据
        ' 这里无法直接区分，统一返回最大范围的 DF_TIMESTAMP TODO
        getDataTypeForPrimitiveData = DF_DataType.DF_TIMESTAMP
    Else
        getDataTypeForPrimitiveData = DF_DataType.DF_STRING
    End If
End Function

' ==========================================
' DataFrame 筛选条件生成
' ==========================================
' 生成一个 And 筛选条件
Public Function cAND(ByRef c As IDFFilterColCondition) As IDFFilterColCondition
    Dim result As DFFilterCompositeCondition
    Set result = New DFFilterCompositeCondition

    result.cAND c

    Set cAND = result
End Function

' ==========================================
' 供 DataFrame 使用的数据筛选条件
' ==========================================
' 检查指定类型的数据是否符合条件
' @param data 需要检查的数据
' @param colType 数据的类型
' @param cds 比较条件
' Public Function checkDataForCondition(ByRef data As Variant, ByRef colType As DF_DataType, ByRef cond As DFDataCondition) As Boolean
'     Dim op As DF_CompareOperator
'     op = cond.compareOperater

'     If op = DF_EQUAL Then
'         ' =
'         checkDataForCondition = checkDataForEqual(data, colType, cond.compareValue)
'     ElseIf DF_NO_EQUAL Then
'         ' !=, <>
'         checkDataForCondition = checkDataForNoEqual(data, colType, cond.compareValue)
'     ElseIf DF_LESS Then
'         ' <, &lt;
'         checkDataForCondition = checkDataForLess(data, colType, cond.compareValue)
'     ElseIf DF_GREATER Then
'         ' >, &gt;
'         checkDataForCondition = checkDataForGreater(data, colType, cond.compareValue)
'     ElseIf DF_LESS_EQUAL Then
'         ' <=, &lt;=
'         checkDataForCondition = checkDataForLessEqual(data, colType, cond.compareValue)
'     ElseIf DF_GREATER_EQUAL Then
'         ' >=, &gt;=
'         checkDataForCondition = checkDataForGreaterEqual(data, colType, cond.compareValue)
'     ElseIf DF_IN Then
'         ' in
'         checkDataForCondition = checkDataForIn(data, colType, cond.compareValue)
'     ElseIf DF_IS Then
'         ' IS
'         checkDataForCondition = checkDataForIs(data, colType, cond.compareValue)
'     ElseIf DF_BETWEEN_AND Then
'         ' between and
'         checkDataForCondition = checkDataForBetween(data, colType, cond.compareValue)
'     Else
'         checkDataForCondition = False
'     End If
' End Function

' ' 检查指定类型的数据是否符合 【=】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForEqual(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         checkDataForEqual = data = val(compareData)
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         checkDataForEqual = data = compareData & ""
'     Else
'         checkDataForEqual = data = compareData
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForEqual = False
' End Function

' ' 检查指定类型的数据是否符合 【!=, <>】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForNoEqual(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         checkDataForNoEqual = data <> val(compareData)
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         checkDataForNoEqual = data <> compareData & ""
'     Else
'         checkDataForNoEqual = data <> compareData
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForNoEqual = False
' End Function

' ' 检查指定类型的数据是否符合 【<, &lt;】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForLess(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         checkDataForLess = data < val(compareData)
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         checkDataForLess = val(data) < val(compareData)
'     Else
'         checkDataForLess = data < compareData
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForLess = False
' End Function

' ' 检查指定类型的数据是否符合 【>, &gt;】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForGreater(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         checkDataForGreater = data > val(compareData)
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         checkDataForGreater = val(data) > val(compareData)
'     Else
'         checkDataForGreater = data > compareData
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForGreater = False
' End Function

' ' 检查指定类型的数据是否符合 【<=, &lt;=】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForLessEqual(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         checkDataForLessEqual = data <= val(compareData)
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         checkDataForLessEqual = val(data) <= val(compareData)
'     Else
'         checkDataForLessEqual = data <= compareData
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForLessEqual = False
' End Function

' ' 检查指定类型的数据是否符合 【>=, &gt;=】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForGreaterEqual(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         checkDataForGreaterEqual = data >= val(compareData)
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         checkDataForGreaterEqual = val(data) >= val(compareData)
'     Else
'         checkDataForGreaterEqual = data >= compareData
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForGreaterEqual = False
' End Function

' ' 检查指定类型的数据是否符合 【in】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForIn(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     Dim i As Integer
'     Dim compareDataMin As Integer
'     Dim compareDataMax As Integer
'     compareDataMin = LBound(compareData)
'     compareDataMax = UBound(compareData)

'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         ' 遍历所有数据，只要有一个匹配就返回 True
'         For i = compareDataMin To compareDataMax
'             If data = val(compareData(i)) Then
'                 checkDataForIn = True
'                 Exit Function
'             End If
'         Next

'         checkDataForIn = False
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         Dim doubleData As Variant
'         doubleData = val(data)

'         ' 遍历所有数据，只要有一个匹配就返回 True
'         For i = compareDataMin To compareDataMax
'             If doubleData = val(compareData(i)) Then
'                 checkDataForIn = True
'                 Exit Function
'             End If
'         Next

'         checkDataForIn = False
'     Else
'         ' 遍历所有数据，只要有一个匹配就返回 True
'         For i = compareDataMin To compareDataMax
'             If data = compareData(i) Then
'                 checkDataForIn = True
'                 Exit Function
'             End If
'         Next

'         checkDataForIn = False
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForIn = False
' End Function

' ' 检查指定类型的数据是否符合 【IS】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForIs(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
'     ' 全部委托给 = 比较运算来处理
'     checkDataForIs = checkDataForEqual(data, colType, compareData)
' End Function

' ' 检查指定类型的数据是否符合 【between and】 条件
' ' @param data 需要检查的数据
' ' @param colType 数据的类型
' ' @param compareData 比较条件
' Public Function checkDataForBetween(ByRef data As Variant, ByRef colType As DF_DataType, ByRef compareData As Variant) As Boolean
' On Error Goto catch:
'     Dim compareDataMin As Integer
'     compareDataMin = LBound(compareData)

'     If colType = DF_DataType.DF_INT Then
'         ' 处理整型
'         ' 检查左值
'         If data < val(compareData(compareDataMin)) Then
'             checkDataForBetween = False
'             Exit Function
'         End If

'         ' 检查右值
'         If data > val(compareData(compareDataMin + 1)) Then
'             checkDataForBetween = False
'             Exit Function
'         End If

'         checkDataForBetween = True
'     ElseIf colType = DF_DataType.DF_DECIMAL Then
'         ' 处理浮点型
'         Dim doubleData As Variant
'         doubleData = val(data)

'         ' 检查左值
'         If doubleData < val(compareData(compareDataMin)) Then
'             checkDataForBetween = False
'             Exit Function
'         End If

'         ' 检查右值
'         If doubleData > val(compareData(compareDataMin + 1)) Then
'             checkDataForBetween = False
'             Exit Function
'         End If

'         checkDataForBetween = True
'     Else
'         ' 检查左值
'         If data < compareData(compareDataMin) Then
'             checkDataForBetween = False
'             Exit Function
'         End If

'         ' 检查右值
'         If data > compareData(compareDataMin + 1) Then
'             checkDataForBetween = False
'             Exit Function
'         End If

'         checkDataForBetween = True
'     End If

'     Exit Function
' catch:
'     ' 如果比较过程中发生问题，全部忽略，并返回 False
'     checkDataForBetween = False
' End Function


' ' ==========================================
' ' 创建筛选条件 DFDataCondition
' ' ==========================================
' ' 创建筛选条件, 【=】
' Public Function createDFDataConditionForEqual( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_EQUAL
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForEqual = result
' End Function

' ' 创建筛选条件, 【!=, <>】
' Public Function createDFDataConditionForNoEqual( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_NO_EQUAL
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForNoEqual = result
' End Function

' ' 创建筛选条件, 【<, &lt;】
' Public Function createDFDataConditionForLess( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_LESS
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForLess = result
' End Function

' ' 创建筛选条件, 【>, &gt;】
' Public Function createDFDataConditionForGreate( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_GREATER
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForGreate = result
' End Function

' ' 创建筛选条件, 【<=, &lt;=】
' Public Function createDFDataConditionForLessEqual( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_LESS_EQUAL
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForLessEqual = result
' End Function

' ' 创建筛选条件, 【>=, &gt;=】
' Public Function createDFDataConditionForGreaterEqual( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_GREATER_EQUAL
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForGreaterEqual = result
' End Function

' ' 创建筛选条件, 【in】
' Public Function createDFDataConditionForIn( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_IN
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForIn = result
' End Function

' ' 创建筛选条件, 【is】
' Public Function createDFDataConditionForIs( _
'     ByRef compareValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_IS
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForIs = result
' End Function

' ' 创建筛选条件, 【between and】
' Public Function createDFDataConditionForBetween( _
'     ByRef compareLeftValue As Variant, _
'     ByRef compareRightValue As Variant, _
'     Optional ByRef tableName As String, _
'     Optional ByRef columnIndex As Integer, _
'     Optional ByRef columnName As String _
'     ) As DFDataCondition

'     Dim result As DFDataCondition
'     Set result = New DFDataCondition
'     result.compareOperater = DF_CompareOperator.DF_BETWEEN_AND
'     result.compareValue = compareValue
'     result.tableName = tableName
'     result.columnIndex = columnIndex
'     result.columnName = columnName

'     Set createDFDataConditionForBetween = result
' End Function
